package com.aspose.cells;

import java.util.ArrayList;

class zbbx {
   public static String[] a = new String[]{"Title", "Subject", "Author", "Keywords", "Description", "LastAuthor", "Revision", "AppName", "TotalTime", "LastPrinted", "Created", "LastSaved", "Pages", "Words", "Characters", "Category", "PresentationFormat", "Manager", "Company", "Guid", "HyperlinkBase", "Bytes", "Lines", "Paragraphs", "CharactersWithSpaces", "Version"};
   public static String[] b = new String[]{"HideHorizontalScrollBar", "HideVerticalScrollBar", "HideWorkbookTabs", "ActiveSheet"};
   public static String[] c = new String[]{"Alignment", "Borders", "Font", "Interior", "NumberFormat", "Protection"};
   static int[] d = new int[]{0, 16777215, 255, 65280, 16711680, 65535, 16711935, 16776960, 128, 32768, 8388608, 32896, 8388736, 8421376, 12632256, 8421504, 16751001, 6697881, 13434879, 16777164, 6684774, 8421631, 13395456, 16764108, 8388608, 16711935, 65535, 16776960, 8388736, 128, 8421376, 16711680, 16763904, 16777164, 13434828, 10092543, 16764057, 13408767, 16751052, 10079487, 16737843, 13421619, 52377, 52479, 39423, 26367, 10053222, 9868950, 6697728, 6723891, 13056, 13107, 13209, 6697881, 10040115, 3355443};
   private static final com.aspose.cells.b.c.a.za e = new com.aspose.cells.b.c.a.za(new String[]{"Between", "Equal", "GreaterOrEqual", "Greater", "LessOrEqual", "Less", "NotBetween", "NotEqual", "single", "double", "none", ".5pt solid", "1.0pt solid", ".5pt dashed", ".5pt dotted", "1.5pt solid", "2.0pt double", ".5pt hairline", "1.0pt dashed", ".5pt dot-dash", "1.0pt dot-dash", ".5pt dot-dot-dash", "1.0pt dot-dot-dash", "1.0pt dot-dash-slanted", "gray-75", "gray-50", "gray-25", "gray-125", "gray-0625", "horz-stripe", "vert-stripe", "reverse-diag-stripe", "diag-stripe", "diag-cross", "thick-diag-cross", "thin-horz-stripe", "thin-vert-stripe", "thin-reverse-diag-stripe", "thin-diag-stripe", "thin-horz-cross", "thin-diag-cross"});

   static String a(int var0) {
      switch(var0) {
      case 0:
         return "Between";
      case 1:
         return "Equal";
      case 2:
         return "Greater";
      case 3:
         return "GreaterOrEqual";
      case 4:
         return "Less";
      case 5:
         return "LessOrEqual";
      case 6:
      default:
         throw new CellsException(6, "Invalid OperatorType val");
      case 7:
         return "NotBetween";
      case 8:
         return "NotEqual";
      }
   }

   static int a(String var0) {
      switch(e.a(var0)) {
      case 0:
         return 0;
      case 1:
         return 1;
      case 2:
         return 3;
      case 3:
         return 2;
      case 4:
         return 5;
      case 5:
         return 4;
      case 6:
         return 7;
      case 7:
         return 8;
      default:
         throw new CellsException(6, "Invalid OperatorType string val");
      }
   }

   static String b(int var0) {
      switch(var0) {
      case 0:
      default:
         return "none";
      case 1:
      case 3:
         return "single";
      case 2:
      case 4:
         return "double";
      }
   }

   static int b(String var0) {
      switch(e.a(var0)) {
      case 8:
         return 1;
      case 9:
         return 2;
      case 10:
      default:
         return 0;
      }
   }

   public static String a(Style var0) {
      StringBuilder var1 = new StringBuilder(30);
      String var2;
      if (var0.isModified(35)) {
         if (!var0.a.a()) {
            var2 = "#" + zase.a(var0.getBackgroundColor());
            var1.append("background:" + var2 + ";");
         } else {
            var1.append("mso-background-source:auto;");
         }
      }

      if (var0.isModified(33) || var0.isModified(34)) {
         var1.append("mso-pattern:");
         if (var0.isModified(34)) {
            var2 = "auto";
            if (!var0.b.a()) {
               var2 = "#" + zase.a(var0.getForegroundColor());
            }

            var1.append(var2 + " ");
         }

         var2 = zsl.b(var0.getPattern());
         var1.append(var2 + ";");
      }

      return com.aspose.cells.b.a.zr.a(var1);
   }

   public static String a(Style var0, int var1) {
      Border var2 = var0.getBorders().getByBorderType(var1);
      int var3 = var2.getLineStyle();
      if (var3 == 0) {
         return "none";
      } else {
         StringBuilder var4 = new StringBuilder(zsl.a(var3));
         if (!var2.a.a()) {
            var4.append(" #" + zase.a(var2.getColor()));
         } else {
            var4.append(" windowtext");
         }

         return com.aspose.cells.b.a.zr.a(var4);
      }
   }

   static Color c(String var0) {
      int var1 = com.aspose.cells.b.a.zo.a(var0, 515);
      Color var2 = Color.fromArgb(var1);
      return var2;
   }

   static int d(String var0) {
      switch(e.a(var0)) {
      case 10:
         return 0;
      case 11:
         return 1;
      case 12:
         return 2;
      case 13:
         return 3;
      case 14:
         return 4;
      case 15:
         return 5;
      case 16:
         return 6;
      case 17:
         return 7;
      case 18:
         return 8;
      case 19:
         return 9;
      case 20:
         return 10;
      case 21:
         return 11;
      case 22:
         return 12;
      case 23:
         return 13;
      default:
         throw new CellsException(6, "Invalid BorderLineStyleString val: " + var0);
      }
   }

   static int e(String var0) {
      switch(e.a(var0)) {
      case 10:
         return 1;
      case 11:
      case 12:
      case 13:
      case 14:
      case 15:
      case 16:
      case 17:
      case 18:
      case 19:
      case 20:
      case 21:
      case 22:
      case 23:
      default:
         return 0;
      case 24:
         return 3;
      case 25:
         return 2;
      case 26:
         return 4;
      case 27:
         return 17;
      case 28:
         return 18;
      case 29:
         return 5;
      case 30:
         return 6;
      case 31:
         return 7;
      case 32:
         return 8;
      case 33:
         return 9;
      case 34:
         return 10;
      case 35:
         return 11;
      case 36:
         return 12;
      case 37:
         return 13;
      case 38:
         return 14;
      case 39:
         return 15;
      case 40:
         return 16;
      }
   }

   static CellArea a(String var0, int var1, int var2) {
      boolean var3 = false;
      new CellArea();
      char[] var5 = var0.toCharArray();
      int var6 = -1;
      int var7 = -1;
      int var8 = -1;
      int var9 = -1;
      boolean var10 = false;
      boolean var11 = false;

      for(int var12 = 0; var12 < var5.length; ++var12) {
         int var13;
         int var14;
         switch(var5[var12]) {
         case ':':
            var3 = true;
            break;
         case 'C':
         case 'c':
            if (var12 + 1 < var5.length) {
               switch(var5[var12 + 1]) {
               case '[':
                  var14 = var12 + 2;

                  for(var12 += 2; var12 < var5.length && var5[var12] != ']'; ++var12) {
                     ;
                  }

                  var13 = com.aspose.cells.b.a.zo.a(var0.substring(var14, var14 + (var12 - var14))) + var2;
                  break;
               default:
                  var14 = var12 + 1;
                  ++var12;

                  while(var12 < var5.length && var5[var12] != ':') {
                     ++var12;
                  }

                  if (var12 != var14) {
                     var13 = com.aspose.cells.b.a.zo.a(var0.substring(var14, var14 + (var12 - var14))) + var2;
                  } else {
                     var13 = var2;
                  }

                  --var12;
               }
            } else {
               var13 = var2;
            }

            if (var3) {
               var9 = var13;
            } else {
               var7 = var13;
            }
            break;
         case 'R':
         case 'r':
            if (var12 + 1 < var5.length) {
               switch(var5[var12 + 1]) {
               case '[':
                  var14 = var12 + 2;

                  for(var12 += 2; var12 < var5.length && var5[var12] != ']'; ++var12) {
                     ;
                  }

                  var13 = com.aspose.cells.b.a.zo.a(var0.substring(var14, var14 + (var12 - var14))) + var1;
                  break;
               default:
                  var14 = var12 + 1;
                  ++var12;

                  while(var12 < var5.length && var5[var12] != ':' && var5[var12] != 'c' && var5[var12] != 'C') {
                     ++var12;
                  }

                  if (var12 != var14) {
                     var13 = com.aspose.cells.b.a.zo.a(var0.substring(var14, var14 + (var12 - var14))) + var1;
                  } else {
                     var13 = var1;
                  }

                  --var12;
               }
            } else {
               var13 = var1;
            }

            if (var3) {
               var8 = var13;
            } else {
               var6 = var13;
            }
         }
      }

      CellArea var4;
      if (var3) {
         if (var6 == -1) {
            var4 = CellArea.createCellArea(var6, 0, var8, 16383);
         } else if (var7 == -1) {
            var4 = CellArea.createCellArea(0, var7, 1048575, var9);
         } else {
            var4 = CellArea.createCellArea(var6, var7, var8, var9);
         }
      } else if (var6 == -1) {
         var4 = CellArea.createCellArea(var6, 0, var6, 16383);
      } else if (var7 == -1) {
         var4 = CellArea.createCellArea(0, var7, 1048575, var7);
      } else {
         var4 = CellArea.createCellArea(var6, var7, var6, var7);
      }

      return var4;
   }

   static CellArea f(String var0) {
      CellArea var1 = new CellArea();
      var0 = var0.toLowerCase();
      int var2 = var0.indexOf(114);
      int var3 = var0.indexOf(99);
      if (var2 != -1 && var3 != -1) {
         String[] var4 = com.aspose.cells.b.a.zv.d(var0, ':');
         byte var5 = 0;
         byte var6 = 0;
         int[] var7 = new int[]{var6};
         int[] var8 = new int[]{var5};
         a(var4[0], var7, var8);
         int var10 = var7[0];
         int var9 = var8[0];
         var1.StartRow = var10;
         var1.StartColumn = var9;
         if (var4.length == 1) {
            var1.EndRow = var1.StartRow;
            var1.EndColumn = var1.StartColumn;
         } else {
            var6 = 0;
            var7 = new int[]{var6};
            var8 = new int[]{var9};
            a(var4[1], var7, var8);
            var10 = var7[0];
            var9 = var8[0];
            var1.EndRow = var10;
            var1.EndColumn = var9;
         }
      } else {
         var1 = g(var0);
      }

      return var1;
   }

   private static CellArea g(String var0) {
      CellArea var1 = new CellArea();
      var0 = var0.toLowerCase();
      int var2 = var0.indexOf(114);
      int var3 = var0.indexOf(99);
      String[] var4;
      if (var2 != -1 && var3 == -1) {
         var4 = com.aspose.cells.b.a.zv.d(var0, ':');
         var1.StartRow = h(var4[0]) - 1;
         if (var4.length == 1) {
            var1.EndRow = var1.StartRow;
         } else {
            var1.EndRow = h(var4[1]) - 1;
         }

         var1.StartColumn = 0;
         var1.EndColumn = 255;
      } else if (var3 != -1 && var2 == -1) {
         var4 = com.aspose.cells.b.a.zv.d(var0, ':');
         var1.StartColumn = h(var4[0]) - 1;
         if (var4.length == 1) {
            var1.EndColumn = var1.StartColumn;
         } else {
            var1.EndColumn = h(var4[1]) - 1;
         }

         var1.StartRow = 0;
         var1.EndRow = 65535;
      }

      return var1;
   }

   static void a(String var0, ArrayList var1) {
      String[] var2 = com.aspose.cells.b.a.zv.d(var0, ',');

      for(int var3 = 0; var3 < var2.length; ++var3) {
         String var4 = var2[var3].trim();
         if (var4.length() > 0) {
            CellArea var5 = f(var4);
            com.aspose.cells.b.a.a.ze.a(var1, (Object)var5);
         }
      }

   }

   private static int h(String var0) {
      boolean var1 = false;
      int var2 = 0;
      int var3 = var0.length();

      int var4;
      for(var4 = 0; var4 < var0.length(); ++var4) {
         char var5 = var0.charAt(var4);
         if (var5 >= '0' && var5 <= '9') {
            if (!var1) {
               var1 = true;
               var2 = var4;
            }

            var3 = var4;
         } else if (var1) {
            break;
         }
      }

      var4 = 1;
      if (var1) {
         String var6 = var0.substring(var2, var2 + var3 - var2 + 1);
         var4 = com.aspose.cells.b.a.zo.a(var6);
      }

      return var4;
   }

   static void a(String var0, int[] var1, int[] var2) {
      var1[0] = 0;
      var2[0] = 0;
      int var3 = -1;
      int var4 = -1;
      int var5 = -1;

      for(int var6 = 0; var6 < var0.length(); ++var6) {
         char var7 = var0.charAt(var6);
         if (var7 != 'R' && var7 != 'r') {
            if (var7 != 'C' && var7 != 'c') {
               if (var7 <= '9' && var7 >= '0') {
                  if (var6 == var0.length() - 1) {
                     var5 = var6 + 1;
                  }
               } else {
                  var5 = var6;
               }
            } else {
               var4 = var6;
            }
         } else {
            var3 = var6;
         }

         if (var3 != -1 && var4 - var3 > 1 && var5 - var4 > 1) {
            var1[0] = com.aspose.cells.b.a.zo.a(var0.substring(var3 + 1, var3 + 1 + (var4 - var3 - 1))) - 1;
            var2[0] = com.aspose.cells.b.a.zo.a(var0.substring(var4 + 1, var4 + 1 + (var5 - var4 - 1))) - 1;
         }

         if (var5 != -1) {
            var4 = -1;
            var5 = -1;
            var3 = -1;
         }
      }

   }
}
